Skip to content

Conversation

@Johan-Liebert1
Copy link
Collaborator

No description provided.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds tests for composefs soft reboot functionality, introducing a reset-soft-reboot command and updating the CLI to handle different soft reboot modes. The changes are generally well-implemented, but I've identified several leftover debugging statements that should be removed to clean up the output. Additionally, there's a critical typo in a test script that needs to be fixed, and a minor encapsulation concern with a newly public field.

# See ../bug-soft-reboot.md - TMT cannot handle systemd soft-reboots
ostree admin prepare-soft-reboot --reset
} else {
bootc internals perp-soft-reboot --reset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

There is a typo in the command: perp-soft-reboot should be prep-soft-reboot. This will cause the test to fail.

        bootc internals prep-soft-reboot --reset

prepare_soft_reboot_composefs(&storage, &booted_cfs, &deployment, reboot)
.await
if reset {
return reset_soft_reboot();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The function reset_soft_reboot returns a Result. It's good practice to handle the result here, even if it's just to propagate the error. The current implementation will ignore any potential errors from reset_soft_reboot.

                            reset_soft_reboot()?

# Assume the localhost/bootc image is up to date, and just run tests.
# Useful for iterating on tests quickly.
test-tmt-nobuild *ARGS:
echo {{ARGS}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This echo statement appears to be for debugging purposes. It should be removed to keep the build output clean.


let Some(nextroot) = nextroot else {
tracing::debug!("Nextroot is not a directory");
println!("No deployment staged for soft rebooting");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The messages printed to the console for user feedback should ideally be directed to stderr instead of stdout. This is a common practice for diagnostic messages, allowing users to separate program output from informational messages. For example, eprintln!("No deployment staged for soft rebooting");.

Suggested change
println!("No deployment staged for soft rebooting");
eprintln!("No deployment staged for soft rebooting");


if !nextroot_mounted {
tracing::debug!("Nextroot is not a mountpoint");
println!("No deployment staged for soft rebooting");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the previous comment, this user-facing message should be printed to stderr rather than stdout.

Suggested change
println!("No deployment staged for soft rebooting");
eprintln!("No deployment staged for soft rebooting");

/// This spawns a separate VM per test plan to avoid state leakage between tests.
#[context("Running TMT tests")]
pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
println!("RunTmtArgs: {args:#?}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This println! appears to be a debugging statement. Please remove it to avoid cluttering the test output.


let firmware_args = build_firmware_args(sh, image)?;

println!("firmware_args: {firmware_args:#?}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This println! seems to be a debugging statement. Please remove it to avoid cluttering the test output.


let imgsrc = imgsrc

print $"USING IMAGE: ($imgsrc)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This print statement appears to be for debugging. It should be removed to keep the test output clean.

if ($imgsrc | str ends-with "-local") {
bootc image copy-to-storage

print $"After copy-to-storage"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This print statement appears to be for debugging. It should be removed to keep the test output clean.

# Now, switch into the new image
print $"Applying ($imgsrc)"
bootc switch --transport containers-storage ($imgsrc)
print $"Switch to ($imgsrc) COMPLETE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This print statement appears to be for debugging. It should be removed to keep the test output clean.

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Aligning with ostree API, now we only initiate soft-reboot if `--apply`
is passed to `bootc update`, `bootc switch`, else we only prepare the
soft reboot

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
After bootc/commit/49d753f996747a9b1f531abf35ba4e207cf4f020,
composefs-rs saves config in the format `oci-config-sha256:`.

Update to match the same

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
When `--download-only` is passed, only download the image into the
composefs repository but don't finalize it.

Conver the /run/composefs/staged-deployment to a JSON file and Add a
finalization_locked field depending upon which the finalize service will
either finalize the staged deployment or leave it as is for garbage
collection (even though GC is not fully implemented right now).

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant